package com.huike.controller.business;

import com.huike.dto.BusinessPoolPageDto;
import com.huike.result.Result;
import com.huike.service.BusinessPoolService;
import com.huike.vo.ClueAssignmentVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/users")
public class BusinessPoolController {
    @Autowired
    private BusinessPoolService businessPoolService;

    @GetMapping("/highSeas/page")
    public Result pagePoolList(BusinessPoolPageDto dto){
        return businessPoolService.pagePoolList(dto);
    }

    /**
     * 批量捞取
     * @param ids
     * @return
     */
    @PutMapping("/highSeas/gain")
    public Result gain(@RequestBody Long[] ids) {
        return businessPoolService.gain(ids);
    }

    /**
     * 公海池和商机的批量分配
     */
    @PutMapping("/highSeas/assignment")
    public Result assignment(@RequestBody ClueAssignmentVo assignmentVo) {
        return businessPoolService.assign(assignmentVo.getIds(), assignmentVo.getUserName());
    }
}
